;; set personalized variables
(setq user-full-name "Corey Oliver")
(setq user-mail-address "corey.jon.oliver@gmail.com")

;; set UTF-8 as the preferred encoding method
(prefer-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8)
(setq default-buffer-file-coding-system 'utf-8)

;; set compilation window size
(setq compilation-window-height 8)

;; set the location where backup files are placed
(if (file-accessible-directory-p (expand-file-name
				  "~/.local/share/Trash/files"))
    (add-to-list 'backup-directory-alist
		 (cons "." (expand-file-name 
			    "~/.local/share/Trash/files/emacs-backups/"))))

;; prevent compilation windows from staying up if successful
;; (setq compilation-finish-function
;;       (lambda (buf str)
;;         (if (string-match "exited abnormally" str)
;;             ;;there were errors
;;             (message "compilation errors, press C-x ` to visit")
;;           ;;no errors, make the compilation window go away in 0.5 seconds
;;           (run-at-time 0.5 nil 'delete-windows-on buf)
;;           (message "NO COMPILATION ERRORS!"))))

;; replace "yes or no" with y or n
(defun yes-or-no-p (arg)
  (y-or-n-p arg))

;; shut off annoying beep. Keep it on only for special situations
(setq visible-bell t)

;; Set some defaults (see efunc.el)
(emacs-control-reset)

;; automatically parses an archive when opened, and lets you
;; selectively open files
(auto-compression-mode 1)

;; set extension and mode associations
(setq auto-mode-alist
      (append '(("\\.[Cc][Xx][Xx]$" . c++-mode)
                ("\\.[Cc][Pp][Pp]$" . c++-mode)
                ("\\.[Hh][Xx][Xx]$" . c++-mode)
                ("\\.[Tt][Cc][Cc]$" . c++-mode)
                ("\\.h$" . c++-mode)
                ("_emacs" . lisp-mode)
                ("\\.el\\.gz$" . lisp-mode)
                ("\\.mak$" . makefile-mode)
                ("\\.conf$" . conf-mode)
                ("Doxyfile.tmpl$" . makefile-mode)
                ("Doxyfile$" . makefile-mode)
		("\\.org$" . org-mode)
                ("\\.scons$" . python-mode)
                ("SCons\\(cript\\|truct\\)" . python-mode)
                ("\\.gclient$" . python-mode)
		("\\.php$" . php-mode)
		("\\.inc$" . php-mode)
		("\\.xml$" . nxml-mode)
		("\\.gp$" . gnuplot-mode)
		("\\.ly$" . LilyPond-mode)
		("\\.ily$" . LilyPond-mode)
		("\\.js$" . javascript-mode)
		("\\.as$" . actionscript-mode)
		("\\.dot$" . graphviz-dot-mode)
		("\\.tex$" . LaTeX-mode)
		("\\.lus$" . lustre-mode)
		("\\.g$" . guru-mode) ;; guru-lang files
		("\\.ml[ily]?$" . tuareg-mode)
		("\\.topml$" . tuareg-mode)
		("\\.scala$" . scala-mode)
                ) auto-mode-alist))

;; switch buffers using tab-completion
(iswitchb-mode 1)
(setq iswitchb-default-method 'samewindow)
